package com.longxi.tianjintianbao.ui.adapter.multitype.approval;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.listener.AdapterListener;
import com.longxi.tianjintianbao.model.approval.ApprovalContentList;

import me.drakeet.multitype.ItemViewBinder;

/**
 * Created by cxw on 2018/2/20.
 */
public class ApprovalContentListViewBinder extends ItemViewBinder<ApprovalContentList, ApprovalContentListViewBinder.ViewHolder> {

    AdapterListener listener;

    public ApprovalContentListViewBinder(AdapterListener listener) {
        this.listener = listener;
    }

    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        View root = inflater.inflate(R.layout.item_approval_content_list, parent, false);
        return new ViewHolder(root);
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull ApprovalContentList approvalContentList) {
        holder.content.setText("合同房号:" + approvalContentList.getName() +
                "\n合计金额:" + approvalContentList.getAmount() +
                "\n合  同  期:" + approvalContentList.getStartdate() + "~" + approvalContentList.getEnddate());
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        TextView content;
        ViewHolder(View itemView) {
            super(itemView);
            content = itemView.findViewById(R.id.content);
        }
    }
}
